package com.shopping.mall.core.module.type.mapper;

import com.shopping.mall.core.module.type.entity.Type;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * TypeMapper 接口
 * </p>
 *
 * @author zzy
 * @since 2021-08-11
 */
@Mapper
public interface TypeMapper extends BaseMapper<Type> {

    @Select("select ifNull(max(order_num),0) from type where parent_id is null")
    Integer selectRootOrderNum();

    @Select("select ifNull(max(order_num),0) from type where parent_id = #{parentId}")
    Integer selectOrderNumByParent(String parentId);
}
